<?php
//生成一条url请求
include_once('func.php');

$url = 'sign.php';
$param = array('name' => 'zhansan', 'password' => '123456', 'timestamp' => time());
$sign = getSignature($param);
$param['sign'] = $sign;
/*
$str = '';
foreach ($param as $k => $v) {
    // 为key/value对生成一个key=value格式的字符串，并拼接到待签名字符串后面
    $str .= "$k=$v" . '&';
}
$str = rtrim($str, '&');**/
$data = urlencode(base64_encode(json_encode($param)));
$str = 'param=' . $data; 
$url .=  '?' . $str;
echo 'server: <a href="' . $url . '" >api : ' . $url . '</a>';